#ifndef SEISMICPARAML_H
#define SEISMICPARAML_H

#include "specparam.h"
#include "tempiritornol.h"
#include "seismicgrid.h"

#include <QList>
#include <QtGui> // SERIALIZZAZIONE

#include "pkeylist.h"
#include "savingstate.h"

class SpecParamL :
        public virtual PKeyList,
        public virtual PReport,
        public virtual FileBased,
        public virtual SavingState
{
public:
    SpecParamL();
    ~SpecParamL();

    SpecParamL(const ExaTabRef& id_tab);

    // Aggiunge i parametri spettrali a partire dalla lista dei tempi di ritorno
    bool fromTr(const TempiRitornoL *tr, const SeismicGrid *sg);

    // Aggiorna i parametri spettrali ricalcolando sulla base di tr ed sg;
    bool fromTrUpdate(const TempiRitornoL *tr, const SeismicGrid *sg);

    // Overridding for [PKeyList] class pure virtual
    virtual const SpecParam&    getAt ( int i )         const;
    virtual       SpecParam&  valueAt ( int i );
    virtual              int   sizeOf ( void )          const;
    virtual             void insertAt ( int i, int nb = 1);
    virtual             void   remove ( int i );
    virtual              void   rename(          int  i,
                                        const string& key,
                                        const string& descr);

    // Overridding for [SavingState]
    virtual void    save ( void );
    virtual void restore ( void );

    // Overridding for [PReport]
    virtual void reportMake( const string& objname = "" ) const;

    // Overridding for [FileBased]
    virtual ExaFileErr fileSave (const string& file_name) const;
    virtual ExaFileErr fileOpen (const string& file_name);
    virtual ExaFileObj  fileObj ( void ) const;

protected:
    // Overridding for [PKeyList] class pure virtual
    virtual bool hasRefAt( int i, const PKeyItem& k ) const;
    virtual bool setRefAt( int i, const PKeyItem& k );

private:
    QList < SpecParam > m_list;
    QList < SpecParam > m_list_cache; // NEED for [SavingState]
    static       string m_objname;    // NEED for [PReport]
    static   ExaFileObj m_file_obj;   // NEED for [FileBased]
};

Q_DECLARE_METATYPE(SpecParamL) // SERIALIZZAZIONE

#endif // SEISMICPARAML_H
